home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Media 4
/
PC MEDIA CD04.iso
/
share
/
udos
/
_100b
/
_100b.arj
/
#.DOC
next >
Wrap
Text File
|
1992-08-28
|
9KB
|
231 lines
┌─────────────────────────────────────────────────────────────────────────────┐
│ # Version 1.00ß │
└─────────────────────────────────────────────────────────────────────────────┘
Purpose
~~~~~~~
# ("octothorp", "number sign", or "hash", whichever you prefer)
is a infix command-line calculator. Features include
factorials, defined constant π (pi), scientific notation
(floating point), hex, decimal, octal, binary input and output
representations, radian or degree representations of angles,
bitwise operators, and integer-specific functions mod and div.
Why did we write this?
~~~~~~~~~~~~~~~~~~~~~~
We found other calculators (TSRs, 4dos' %@eval[]) to be
inadequate and/or cumbersome in many situations. As a result,
we decided to write one for ourselves. Originally it only had
support for expressions and bitwise operators, but features were
added to make it more versatile and easy to use.
Usage
~~~~~
Typing "#" and pressing Enter at the command line will result in
the following screen:
# Version 1.00ß Copyright 1991 by Amit K. Mathur and Peter Harwood.
Usage: # </outputparameters> <expression to evaluate>
Where the expression can contain any of the following:
'+', '-', '*', '/', '^', and '!' operators
brackets, nested as deep as you want
'e' to specify scientific notation
'pi', specifically 3.14159265358979
the trig functions 'sin', 'cos', 'tan', and 'atan'
the logarithmic functions 'exp' and 'ln'
'sqrt' as an alternative to numeric^0.5
the Integer only functions 'div' and 'mod'
the bitwise operators 'not', 'and', 'shl', 'shr',
'xor', and 'or'
you can prefix a number with an '$','%','O', or 'D' to
specify hex, binary, octal or degrees respectively
Output Parameters are 'b' for binary, 'h' for hex,
'd' for decimal, 'o' for octal or any combination.
# can handle values from 3.4e-4932 to 1.1e4932
An arithmetic expression typed after the "#" (and a space!) will
be evaluated and output.
Ex #1. Typing "# 3+4(9)" and pressing Enter will result in the
following:
# Version 1.00ß Copyright 1991 by Amit K. Mathur and Peter Harwood.
Math Co-processor Detected and Utilized.
3+4(9)= 39
Note in this case the lack of the "*" to indicate
multiplication. It is actually optional in this case. Note
also that on a computer with no math co-processor, a message of
"No Math Co-Processor Found, Emulation Used." will instead
result.
Ex #2. Typing "# /bo %011011011 shl 2 xor ($34 and (o707773645 div
3))" will result in the following:
# Version 1.00ß Copyright 1991 by Amit K. Mathur and Peter Harwood.
Math Co-processor Detected and Utilized.
%011011011shl2xor($34and(o707773645div3))= 1530 in octal
%011011011shl2xor($34and(o707773645div3))= 1101011000 in binary
The "/bo" indicates your wish to see binary and octal
representations of the answer. The spaces within the expression
are filtered out by the parser.
Ex #3. Typing "# sin(d90)*4!+exp(2)^sqrt(2*tan(pi/4))" will yield:
# Version 1.00ß Copyright 1991 by Amit K. Mathur and Peter Harwood.
Math Co-processor Detected and Utilized.
sin(d90)*4!+exp(2)^sqrt(2*tan(pi/4))= 40.9188286785579
The "d" in "sin(d90)" indicates that the number following the
"d" is in degrees. (It is converted to radians)
Notes
~~~~~
Brackets can virtually be nested as deeply as you want,
considering that you will hit the DOS command-line limit before
you can blow our stack.
In 4dos, users will realize that the carat ("^") is used to
separate commands. This conflicts with our exponent function.
One way around it is to use the 4dos escape character. This
character is by default Control-X (""). Type this character
before the carat and 4dos will ignore the command separator.
Another way is to redefine the command separator to something
else in your 4dos.ini file (or with SETDOS).
Another conflict with 4dos is the percent character ("%") used
to indicate binary numbers. 4dos tries
Make sure when using the different output formats to put your
parameters BEFORE the expression. If you do not, # will think
it is part of the expression! Also remember that multiple
output parameters must be grouped together after the "/", eg.
"/bdh" for binary, decimal, and hex output.
We decided not to write in support for floating point using
other bases than ten (decimal). First of all, there's no real
reason for it, and second, we couldn't get it working quite
correctly due to floating point errors in base conversion.
Things like "# and" will work. The reason for this is that a
zero is implied after and before the "and", similar to a one
being implied between brackets.
License
~~~~~~~
# v1.00 is Copyright 1991-1992 by Amit K. Mathur and Peter Harwood,
Windsor, Ontario, Canada.
You are hereby granted the license to use # for a 21 day
evaluation period, after which time you are required to register
# with the authors in order to use it further.
The authors can not accept any damages, direct or indirect, that
may arise from the use of #. We have taken every precaution
to ensure that it is completely bug free. To the best of our
knowledge this program is in perfect working order.
Contacting the Authors
~~~~~~~~~~~~~~~~~~~~~~
Should any problems or questions arise about the use of #
then you can reach the authors any of the following ways:
Through RIME(tm) or RelayNet
AMIT MATHUR ->WINDSOR (R/O Capable)
Through InterNET
pkharwood@napier.uwaterloo.ca
Personally
Amit k. Mathur Peter Harwood
3215 St. Patrick's Drive 2497 Via Vita
Windsor, Ontario Windsor, Ontario
N9E 3H2 CANADA N9E 4C7 CANADA
(519) 966-6924 (519) 966-4246
History of #
~~~~~~~~~~~~
version 1.00ß
- Initial release, for testing purposes.
For the Future
~~~~~~~~~~~~~~
- a 4dos-happy version
- an OS/2 version
- implement of the gamma function for real-valued factorials (pi!)
- any suggestions you may have
Registration Form
~~~~~~~~~~~~~~~~~
------------------------------------------------------------------------------
Complete this form and mail along with your registration fee to:
Amit K. Mathur
3215 St. Patrick's Drive
Windsor, Ontario
N9E 3H2 CANADA
Name : _____________________________________________________
Address : _____________________________________________________
_____________________________________________________
City : ____________________________________ State : ________
Country : ____________________________________
Zip : ____________________ Telephone : (_____) ____________
E-Mail : _____________________________________________________
I would prefer [ ] 5¼" or [ ] 3½" disks.
# v1.00ß Registration ...................................$15.00
5+ #s (Site License) .............................. Each $10.00
_______________________________________________________________
Enclosed ......................................... $___________
*** Make Cheques Payable to "Amit K. Mathur" or "Peter Harwood"
Enhancements you would like to see : __________________________
_______________________________________________________________
Note that this is a beta version and comments would be MUCH
appreciated!
Comments : ____________________________________________________
_______________________________________________________________
_______________________________________________________________
_______________________________________________________________
Registration is Lifetime - Once you have registered with us
you will be notified of major upgrades and given the option to
order them at no extra cost other than Shipping and Handling.
Thank you for your support of the Shareware concept and of #.